// pages/demo/demo.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    name: "",
    startHour: 0,
    startMinute: 0,
    time: 15,
  },

  gettime(e){
      console.log(e)
  },

  getlast(e){
      console.log(e)
  },

  listBook:function() {
    wx:wx.navigateTo({
      url: '/page/now/now',
    })
  },
  onLoad(options) { 

    this.setData({
      name : options.name
  })
        // console.log("213")
        // console.log(options)
        //console.log(this.data.name)
        //console.log("213")
  },

  formSubmit:function(e) {
    // console.log(e.detail.value);
    var that = e.detail.value;
    // console.log(that);
    wx.request({
      url: 'http://123.249.18.48:8100/book/add',
      method: 'POST',
      data: {
        name: this.data.name,
        time: that.time,
        startHour: that.startHour,
        startMinute: that.startMinute
      },
      
      // header: {
      //   'content-type': 'application/x-www-form-urlencoded' 
      // },
      dataType: 'json',
      success(res) {
        console.log(that.name+"  "+that.time);
        wx.showToast({
          title: '成功'
        });
      }
    });
  }
})